//
//  PlayerCell.m
//  YUXiu
//
//  Created by wang on 16/6/27.
//  Copyright © 2016年 Wang. All rights reserved.
//

#import "PlayerCell.h"

@implementation PlayerCell

//80
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleL = [[UILabel alloc]initWithFrame:krect(10, 10, kScreenWidth-80, 20)];
        _titleL.font = Font(15);
        [self.contentView addSubview:_titleL];
        
        NSString *str = @"练习时长:30分钟";
        CGSize size = CGSizeMake(999, 20);
        UIFont *font = Font(12);
        float wd = [str boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : font} context:nil].size.width;
        _desLabel = [[UILabel alloc]initWithFrame:krect(10, 55, wd, 20)];

        _desLabel.font = Font(12);
        _desLabel.textColor = kLightGrayCOLOR;
        [self.contentView addSubview:_desLabel];
        
        _playingL = [[UILabel alloc]initWithFrame:krect(_desLabel.golf_right + 10, 55, 90, 20)];
        _playingL.font = Font(12);
        _playingL.textColor = kOrangeCOLOR;
        [self.contentView addSubview:_playingL];
        
        _playButton = [[UIButton alloc]initWithFrame:krect(kScreenWidth-60, 15, 50, 50)];
        _playButton.layer.cornerRadius = 25;
        
        [_playButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
               
        [self.contentView addSubview:_playButton];
        
        UIView *lien = [[UIView alloc]initWithFrame:krect(2, 79, kScreenWidth-4, 1)];
        lien.backgroundColor = kLightGrayCOLOR;
        [self.contentView addSubview:lien];
    }
    return self;
}
-(void)layoutSubviews{
//    _titleL.text = @"第一天 : 缓解全身压力";
//    _desLabel.text = @"练习时长:30分钟";
//    [_playButton setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    

}

-(void)click{
    if (_block) {
        _block();
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
